﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Collections;
using System.Data.Common;
using System.Configuration.Assemblies;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ausy.Servey.QuestionProvider.Contract;
using Ausy.Servey.QuestionProvider;
using System.Data.SqlClient;
using Ausy.Silverlight.Survey.QuestionModule.Model;

namespace Ausy.Servey.ServiceUnitTests
{
    [TestClass]
    public class QuestionServiceUnitTest
    {
        [TestMethod]
        public void GetQuestionnaireByIdentifierTest()
        {
            IQuestionService service = new QuestionService();
            var questionnaire = service.GetQuestionnaireByIdentifier(Guid.Parse("7D9DDC81-FB47-4739-967C-11B30F744D6F"));
        }


        [TestMethod]
        public void CreateUserQuestionnaireTest()
        {
            IQuestionService service = new QuestionService();
            var userQuestionnaire = new UserQuestionnaire();
            userQuestionnaire.Identifier = Guid.NewGuid();
            userQuestionnaire.QuestionnaireReferenceID = Guid.Parse("7D9DDC81-FB47-4739-967C-11B30F744D6F");
            userQuestionnaire.QuestionnaireResult = Convert.ToDecimal(99.9);
            userQuestionnaire.TimeSpanComplete = new TimeSpan(0,0,1,10,100);
            userQuestionnaire.AccountReferenceID = Guid.Parse("BD5A00F5-50F3-48C2-A99E-22A51B59997C");

            //
            var userQuestionResponse1 = new UserQuestionnaireResponse();
            userQuestionResponse1.QuestionReferenceID = Guid.Parse("490F9CAF-BE4E-462E-A9B2-13DC79FB1387");
            userQuestionResponse1.ResponseAnswerCollection.Add(Guid.Parse("28DD9C76-8F1B-4913-99E2-C1BDD9F47DD6"));
            userQuestionResponse1.ResponseAnswerCollection.Add(Guid.Parse("8B31859E-4A51-4EFA-A145-D4B0AFAA1AD2"));
            userQuestionResponse1.ResponseResult = 1;
            userQuestionResponse1.TimeSpanComplete = new TimeSpan(0, 0, 1, 10, 100);
            userQuestionnaire.QuestionnaireResponseCollection.Add(userQuestionResponse1);

            var userQuestionResponse2 = new UserQuestionnaireResponse();
            userQuestionResponse2.QuestionReferenceID = Guid.Parse("C0D5412F-028B-427E-8CC6-F3829A3FDB14");
            userQuestionResponse2.ResponseAnswerCollection.Add(Guid.Parse("8B31859E-4A51-4EFA-A145-D4B0AFAA1AD2"));
            userQuestionResponse2.ResponseResult = 1;
            userQuestionResponse2.TimeSpanComplete = new TimeSpan(0, 0, 0, 56, 100);
            userQuestionnaire.QuestionnaireResponseCollection.Add(userQuestionResponse2);

            service.CreateUserQuestionnaire(userQuestionnaire);
        }
    }
}
